package d1208.Ljs2.Ljs7;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.List;

public class Demo1 {
    public static void main(String[] args) throws Exception{
        Class<?>clazz=Class.forName("Ljs2.Ljs7.Cat");
        Constructor<?> constructor = clazz.getConstructor();
        Object o = constructor.newInstance();
        Method setName=clazz.getMethod("setName", String.class);
        List<String>list=FileUtils.readLines(new File("E:\\代码\\代码练习和作业\\Zuoye12月6号\\src\\Ljs2\\Ljs7\\CatData.txt"));
        for (int i = 0; i < list.size(); i++) {
            String s = list.get(i).replace("'", "");
            String s1 = s.replace(" ", "=");
            String[] arr = s1.split("=");
            System.out.println(arr[1]);
            Object o1 = setName.invoke(o, arr[1]);
            System.out.println(o1);
        }

    }
}
